﻿@using CNKI.TPI.Web.Base
@using CNKI.TPI.Web.Search.Model
@{
    Layout = null;
}
@if (ViewBag.DbList != null && ViewBag.DbList.Count > 0)
{
    foreach (int sn in ViewBag.TitleType)
    {
        string strStyleStart = "<div class=\"huxi\"><div class=\"tupianliebiao\"> <ul>";
        string strStyleEnd = " </ul></div></div>";
        string title = "";
        if (sn == (int)MediaType.Pic)
        { title = "相关图片"; }
        else if (sn == (int)MediaType.Video)
        { title = "相关视频"; }
        else if (sn == (int)MediaType.Audio)
        { title = "相关音频"; }
        else if (sn == (int)MediaType.Ebook)
        { title = "相关电子书"; }
        else
        {
            title = "相关文献";
            strStyleStart = "<ul class=\"xs-doc-ul\">";
            strStyleEnd = "</ul>";
        }

        foreach (SYS_CMS_DATABASE s in (IList<SYS_CMS_DATABASE>)ViewBag.DbList)
        {
            if (sn == s.TemplateID) //同一分类显示在一个标题下面
            {
                int len = ((Dictionary<string, System.Data.DataTable>)ViewBag.TableList)[s.DatabaseCode].Rows.Count;
                <h2><span>@s.DatabaseName</span></h2>
               @*<h3 class="xs-doc-title">@s.DatabaseName</h3>*@
                //显示格式

               @Html.Raw(strStyleStart)
                int i = 1;
                foreach (System.Data.DataRow dr in ((Dictionary<string, System.Data.DataTable>)ViewBag.TableList)[s.DatabaseCode].Rows)
                {
                    if (s.TemplateID == (int)MediaType.Pic || s.TemplateID == (int)MediaType.Video || s.TemplateID == (int)MediaType.Audio)
                    {
                        <li><a target="_blank" href="@dr["SYS_FLD_URL"]">
                            <img width="205" height="154" src="@ResourceHelper.GetFirstSmallPicURL(s.SysID, int.Parse(@dr["SYS_FLD_SYSID"].ToString()))" />
                        </a>
                            <div class="zhezhao">@Html.Raw(dr[0])</div>
                        </li>
                    }
                    else if (s.TemplateID == (int)MediaType.Ebook)
                    {
                        <li class="book-list">
                            <a target="_blank" href="@dr["SYS_FLD_URL"]">
                                <img width="135" height="180" src="@ResourceHelper.GetFirstSmallPicURL(s.SysID, int.Parse(@dr["SYS_FLD_SYSID"].ToString()))" />
                            </a>
                            <div class="zhezhao">@Html.Raw(dr[0])</div>
                        </li>
                    }
                    else //文本格式
                    {
                        <li><a target="_blank" href="@dr["SYS_FLD_URL"]">@Html.Raw("["+i+"]" + dr[0])</a></li>
                    }
                    i++;
                }
                 @Html.Raw(strStyleEnd)
            }

        }
    }
}
